package com.vitabuybuy.tv.ui.mine.talent.usercenter

import android.os.Bundle
import android.view.View
import com.library.common.base.BaseActivity
import com.library.common.ext.setOnclickNoRepeat
import com.vitabuybuy.tv.R
import com.vitabuybuy.tv.databinding.ActivityLiveIncomeManageBinding
import com.vitabuybuy.tv.ui.WebViewActivity
import com.vitabuybuy.tv.ui.mine.talent.usercenter.viewmodel.LiveIncomeManageViewModel
import kotlinx.android.synthetic.main.activity_live_income_manage.*

class LiveIncomeManageActivity :
    BaseActivity<LiveIncomeManageViewModel, ActivityLiveIncomeManageBinding>() {
    override val isUseBaseTitleBar: Boolean
        get() = true
    override val layoutId: Int
        get() = R.layout.activity_live_income_manage

    override fun initView(savedInstanceState: Bundle?) {
        setTitle(getString(R.string.live_income_manage))
        mTvRight.apply {
            text = getString(R.string.explanation)
            visibility = View.VISIBLE
            setOnClickListener {
                WebViewActivity.openActivity(mContext, "", "", 29)
            }
        }
        mBinding.mViewModel = viewModel
    }

    override fun onResume() {
        super.onResume()
        viewModel.getMyWallet()
    }
    override fun eventHandling() {
        setOnclickNoRepeat(rlExchangeCurrency, rlIncomeRecord, rlExchangeRecord){v->
            when (v) {
                rlExchangeCurrency -> LiveIncomeWithdrawActivity.openActivity(mContext,viewModel.myWallet.get())
                rlIncomeRecord -> LiveIncomeRecordActivity.openActivity(mContext, "收入")
                rlExchangeRecord -> LiveIncomeRecordActivity.openActivity(mContext, "支出")
            }
        }
    }

    companion object {
        fun openActivity(mContext: BaseActivity<*, *>) {
            mContext.startActivity(null, LiveIncomeManageActivity::class.java)
        }
    }
}
